Skip to content

[ui] HTTP RPC Engine attempts reconnection until disposal#168

Merged
colin-grant-work merged 2 commits intosokatoafrom
feature/just-keep-reconnecting
Jan 23, 2026
Merged

[ui] HTTP RPC Engine attempts reconnection until disposal#168
colin-grant-work merged 2 commits intosokatoafrom
feature/just-keep-reconnecting

Conversation

@colin-grant-work
Copy link
Collaborator

Welcome to Perfetto!
Make sure your PR has a bug/issue attached or has at least
a clear description of the problem you are trying to fix.

This PR modifies the behavior of the HTTP RPC Engine so that it continues to attempt to reconnect, at progressively longer intervals, until it is disposed of. It will not throw errors to the window object on error or on disconnection.

For more details please see
https://perfetto.dev/docs/contributing/getting-started

Copy link
Collaborator

@cdamus cdamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! My tests with a script that forcibly closed the socket file descriptor in the Trace Processor Shell seems to show that the reconnection works.

I have a couple of nits remarked in-line. Maybe something to consider before merge or possibly for a follow-up ticket.

Another thing I wonder about is that while we're disconnected the queue of requests from Perfetto UI to the trace processor can pile up. Does it need to be limited to some maximum and, if exceeded, we give up retrying the disconnect and call super.fail() as we did previously to force the UI to error out? I'm not sure whether it's realistic to expect this queue actually can grow too large. Maybe this is another matter to table in a follow-up.

Copy link
Collaborator

@cdamus cdamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Tested with the Sokatoa-side PR.

rpcSendRequestBytes(data: Uint8Array): void {
if (this.disposed) return;
this.websocket ??= this.initWebSocket();
const websocket = this.getOrCreateWebSocket();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much prefer this nomenclature. Thanks!

@colin-grant-work colin-grant-work merged commit 061c738 into sokatoa Jan 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants